package com.example.moviecms2.utils;

import com.example.moviecms2.vo.RestfulVO;

/**
 * 统一API接口响应结果生成工具
 */
public class ResultVOUtils {
    public static <T> RestfulVO<T> success(T data) {
        RestfulVO<T> vo = new RestfulVO<>();
        vo.setCode(200);
        vo.setMsg("成功");
        vo.setData(data);
        return vo;
    }

    public static <T> RestfulVO<T> fail() {
        RestfulVO<T> vo = new RestfulVO<>();
        vo.setCode(500);
        vo.setMsg("失败");
        vo.setData(null);
        return vo;
    }

}
